@extends('admin.layout.index')

@section('content')
    
    <div class="portlet-body">

        <div id="sample_2_wrapper" class="dataTables_wrapper form-inline" role="grid">

            <form action="/order" method="get">
                <div class="row-fluid">
                    <div class="span6">
                        <div id="sample_1_length" class="dataTables_length">
                            <label>
                                <select size="1" name="count" aria-controls="sample_1" class="m-wrap small">
                                    <!-- <option value="5" selected="selected">5</option>
                                    <option value="15">15</option>
                                    <option value="20">20</option>
                                    <option value="-1">All</option> -->
                                    <option value="10" @if(!empty($request['count']) && $request['count'] == 10) selected @endif>10</option>
                                    <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>20</option>
                                    <option value="30" @if(!empty($request['count']) && $request['count'] == 30) selected @endif>30</option>
                                    <option value="50" @if(!empty($request['count']) && $request['count'] == 50) selected @endif>50</option>
                                </select> 每页显示条数
                            </label>
                        </div>
                    </div>
                <div class="span6">
                    <div class="dataTables_filter" id="sample_1_filter">
                        <label>搜索:
                            <!-- <input type="text" aria-controls="sample_1" class="m-wrap medium"> -->
                            <input type="text" name="search" value="{{$request['search'] or ''}}" aria-controls="sample_1" class="m-wrap medium">
                            <input type="submit" class="btn green" value="搜索">
                        </label>
                    </div>
                </div>
            </div>
        </form>

           
     <table class="table table-striped table-bordered table-hover table-full-width dataTable" id="sample_2" aria-describedby="sample_2_info">

        <thead>

            <tr role="row">

                <th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="Rendering engine: activate to sort column ascending" style="width: 192px;">ID</th>

                <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Browser: activate to sort column descending" style="width: 261px;">订单号</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 239px;">用户名</th>


                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">收件人</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">电话</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">地址</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">下单时间</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">消费</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending" style="width: 165px;">商品标题</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">商品单价</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">订单状态</th>

                <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="sample_2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 119px;">操作</th>

            </tr>

        </thead>

        

    <tbody role="alert" aria-live="polite" aria-relevant="all">

        @foreach($data as $k=>$v)
        <tr class="odd">
               
                <td class=" ">{{$v['id']}}</td>

                <td class="  sorting_1">{{$v['code']}}</td>

               


                <td class="hidden-480 ">{{$v['username']}}</td>
                

                <td class="hidden-480 ">{{$v['name']}}</td>

                <td class="hidden-480 ">{{$v['tel']}}</td>

                <td class="hidden-480 ">{{$v['address']}}</td>

                <td class="hidden-480 ">{{$v['ordertime']}}</td>

                <td class="hidden-480 ">{{$v['cost']}}</td>

                <td class="hidden-480 ">{{$v['title']}}</td>

                <td class="hidden-480 ">{{$v['price']}}</td>

                <td class="hidden-480 ">{{$v['status']}}

                     <a href="/order/{{$v['id']}}/edit"><i class="icon-briefcase">修改</i></a>                  
                </td>

               <td class="hidden-480 ">

                    <a href="javascript:void(0)" onclick="details({{$v['id']}})"><i class="icon-calendar">详情</i></a>

                </td> 
            @endforeach
        </tr>

    </tbody>
    </table>
        <div class="dataTables_paginate paging_bootstrap pagination" style="float:right">
              {!! $data->appends($request)->render()!!}
        </div>    
    </div>
</div>

    <script>

        function details(id){

            // alert(id);
            // exit;

            // layer.open({
            //       type: 2,
            //       title: '用户详情',
            //       shadeClose: true,
            //       shade: 0.8,
            //       area: ['666px', '90%'],
            //       content: 'order/details' //iframe的url
            //         }); 

            $.get('{{url("/order/")}}/'+id,{},function(data){
            //页面层
            layer.open({
                type: 1,
                title:"买家信息",
                skin: 'layui-layer-rim', //加上边框
                area: ['820px', '240px'], //宽高
                content: data
                });
            });
          
        }

    </script>
@endsection